#include "parsethread.h"

ParseThread::ParseThread()
{
    parser = 0;
}

void ParseThread::run()
{
	parser = new Parser();
	connect(parser, SIGNAL(countFinished()), this, SLOT(quit()));
	parser->setUrl(url);
	parser->getPage();
	exec();
}

QMap <QString, int> ParseThread::getCount()
{
    return parser->getCount();
}

QNetworkReply *ParseThread::getReply()
{
    return parser->getReply();
}

void ParseThread::begin(QUrl url)
{
    if (parser != 0)
    {
        parser->~QObject();
    }
    this->url = url;
    start();
}
